<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
<a href="http://www.baidu.com"  id="imgid" >
		百度
	</a>
</body>
<script type="text/javascript">
	aobj=document.getElementById('aid');
	aobj.onclick=function(){
		r=confirm('are you sure to load baidu');
		if(r){
			alert(1);
		}else{
			alert(2);
		}
	}
</script>
</html>